<?php 
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/

	defined('_JEXEC') or die('Restricted access'); 
	global $jbconfig;
	
?>
<div class="componentheading"><?php echo $jbconfig['emails']->get('sitename')." RSS Feed"; ?></div>
<span>
	<?php 
		$msg = JText::_("The ").$jbconfig['emails']->get('sitename').JText::_(" RSS feed delivers job search results as an RSS feed. ");
		$msg .= JText::_("You can then save those results in any favourite feed aggregator, or incorporate that data into your own website or client application. ");
		$msg .= JText::_("The RSS feed is a dynamically-generated feed: start with the base URL, add parameters for your location, the job category you're looking for. ");
		$msg .= JText::_("You'll get back just the information you've requested.");
		echo $msg;
	?>
</span>
<br /><br />
<span>

<h3>
		<?php 
			echo JText::_("Standard RSS ");
		?>
</h3>

<table class="tablelist" width="100%">
	<thead>
		<tr>
			<td class="sectiontableheader">#</td>
			<td class="sectiontableheader" width="35%">
				<?php 
					echo JText::_("Simple URL");
				?>
			</td>
			<td class="sectiontableheader" width="50%">
				<?php 
					echo JText::_("Detail URL");
				?>
			</td>
			<td class="sectiontableheader" width="15%">
				<?php 
					echo JText::_("Description");
				?>
			</td>
		</tr>
	</thead>
	
    <?php
            $k = 0;
            for ($i=0, $n=count( $this->items ); $i < $n; $i++) {
            	if ($i==0)
            		$class_name = 'first sectiontableentry'.(($i%2)+1);
            	elseif ($i==$n-1)
            		$class_name = 'last sectiontableentry'.(($i%2)+1);
            	else 
            		$class_name = 'sectiontableentry'.(($i%2)+1);
                $row = &$this->items[$i];

                $checked 	= JHTML::_('grid.id',  $i, $row->id );
                $published 	= JHTML::_('grid.published', $row, $i );
				$str_filter = '';
				$str_filter .= "&type=$row->feed_type";
				$str_filter .= "&name=$row->feed_name";
				if (($row->msg_count!=0)&&($row->msg_count!=null))
					$str_filter .= "&job_number=$row->msg_count";
				$str_filter .= "&cache=$row->feed_cache";
				$str_filter .= "&description=$row->feed_description";
				$str_filter .= "&order_by=$row->msg_orderby";
				$str_filter .= "&html=$row->feed_renderHTML";
				$str_filter .= "&image=$row->feed_renderImages";
				if (($row->filter_cat_id!='')&&($row->filter_cat_id!=null))
				{
					$db = JFactory::getDBO();
					$query = "SELECT  name FROM #__ja_categories WHERE id IN ($row->filter_cat_id)";
					$db->setQuery($query);
					$result = $db->loadResultArray();
					if (is_array($result))
						$str_filter .= "&category=".implode(',',$result);	
				}				
				if (($row->filter_location_id!='')&&($row->filter_location_id!=null))
				{	
					$db = JFactory::getDBO();
					$query = "SELECT  name FROM #__ja_location WHERE id IN ($row->filter_location_id)";
					$db->setQuery($query);
					$result = $db->loadResultArray();
					if (is_array($result))
						$str_filter .= "&location=".implode(',',$result);	
					
				}
				if (isset($row->filter_zipcode) && ($row->filter_zipcode!='')&&($row->filter_zipcode!=null))
					$str_filter .= "&zipcode=$row->filter_zipcode";
				if (($row->filter_date!='')&&($row->filter_date!=null))
					$str_filter .= "&effected_date=$row->filter_date";
				if ($row->filter_is_premium)
					$str_filter .= "&premium=1";
				if (($row->filter_exitems!='')&&($row->filter_exitems!=null))	
					$str_filter .= "&exitems=$row->filter_exitems";
				if (($row->filter_exemployers!='')&&($row->filter_exemployers!=null))	
					$str_filter .= "&exemployers=$row->filter_exemployers";
				if (($row->filter_inemployers!='')&&($row->filter_inemployers!=null))	
					$str_filter .= "&inemployers=$row->filter_inemployers";
				$feedurl_display = JRoute::_( "index.php?option=com_jajobboard&view=jafeeds&layout=RSS").$str_filter;
                $feedurl = JRoute::_( "index.php?option=com_jajobboard&view=jafeeds&layout=rss&".$str_filter);
                $simple_url = JRoute::_("index.php?option=com_jajobboard&view=jafeeds&layout=rss&cid[]=".$row->id."&feed_alias=".$row->feed_alias);
                ?>
            <tr class="<?php echo $class_name; ?>">
                <td><?php echo $this->pagination->getRowOffset( $i ); ?></td>
                <td width="35%">

                    <span class="editlinktip hasTip" title="<?php echo JText::_( 'View RSS' );?>::<?php echo $this->escape($row->feed_name); ?>">
                        <a href="<?php echo $simple_url; ?>"  target="_blank">
                    <?php echo str_replace('&',' &',$simple_url); ?></a></span>

                </td>
                <td width="50%">

                    <span class="editlinktip hasTip" title="<?php echo JText::_( 'View RSS' );?>::<?php echo $this->escape($row->feed_name); ?>">
                        <a href="<?php echo $feedurl ?>"  target="_blank">
                    <?php echo str_replace('&',' &',$feedurl_display); ?></a></span>

                </td>
                <td width="15%"><?php echo $row->feed_description; ?></td>
                
            <?php		$k = 1 - $k; ?>		</tr>
            <?php	}
        ?>
</table>
<a class="button" href="<?php echo JRoute::_("index.php?option=com_jajobboard&view=jafeeds&layout=form"); ?>" target="_blank"><?php echo JText::_("Create advance RSS"); ?></a>

<!--<table class="tablelist" width="100%">
	<tr>
		<td class="sectiontableheader" width="70%">
			<?php 
				echo JText::_("RSS URL");
			?>
		</td>
		<td class="sectiontableheader" width="30%">
			<?php 
				echo JText::_("Description");
			?>
		</td>
	</tr>
	<tr class="sectiontableentry1">	
		<td>
	<b>
	<?php 
		echo JRoute::_(JURI::root()."index.php?option=com_jajobboard&view=jafeeds&cid[]=1");
	?>
	</b>
		</td>
		<td>
			<?php 
				echo JText::_("All jobs posted today");
			?>
		</td>
	</tr>
	<tr class="sectiontableentry2">	
		<td>
<b>
	<?php 
		echo JRoute::_(JURI::root()."index.php?option=com_jajobboard&view=jafeeds&cid[]=2");
	?>
	</b>
		</td>
		<td>
			<?php 
				echo JText::_("All jobs posted last 3 days");
			?>
		</td>
	</tr>
	<tr class="sectiontableentry1">	
		<td>
<b>
	<?php 
		echo JRoute::_(JURI::root()."index.php?option=com_jajobboard&view=jafeeds&cid[]=3");
	?>
	</b>
		</td>
		<td>
			<?php 
				echo JText::_("All jobs posted last 7 days");
			?>
		</td>
	</tr>
	<tr class="sectiontableentry2">	
		<td>
<b>
	<?php 
		echo JRoute::_(JURI::root()."index.php?option=com_jajobboard&view=jafeeds&cid[]=3");
	?>
	</b>
		</td>
		<td>
			<?php 
				echo JText::_("Premium jobs posted today");
			?>
		</td>
	</tr>
	<tr class="sectiontableentry1">	
		<td>
<b>
	<?php 
		echo JRoute::_(JURI::root()."index.php?option=com_jajobboard&view=jafeeds&cid[]=3");
	?>
	</b>
		</td>
		<td>
			<?php 
				echo JText::_("Premium jobs posted last 3 days");
			?>
		</td>
	</tr>
	<tr class="sectiontableentry2">	
		<td>
<b>
	<?php 
		echo JRoute::_(JURI::root()."index.php?option=com_jajobboard&view=jafeeds&cid[]=3");
	?>
	</b>		</td>
		<td>
			<?php 
				echo JText::_("Premium jobs posted last 7 days");
			?>
		</td>
	</tr>

</table>
-->
<h3>
		<?php 
			echo JText::_("Advanced RSS Request");
		?>
</h3>

	<?php 
		echo JText::_("The RSS feed request URL looks like this").":";
	?>
	<br /><br />
	<b>
	<?php 
		echo JRoute::_(JURI::root()."index.php?option=com_jajobboard&view=jafeeds&cid[]=3&category=<span class='highlight'>Finance,Franchise</span>&effected_date=<span class='highlight'>30</span>&exitems=<span class='highlight'>1</span>&exemployers=<span class='highlight'>2</span>");
	?>
	</b>
	<br /><br />
	<?php 	
		echo JText::_("Where each of the values of location, job category, posted date ... are replaced with specific value. If the param is not inluded or invalid, they will get the default values which is set by Admin ");
	?>
	<br /><br />
	<?php 	
		echo JText::_("All paras can be config via URL syntax, each paras can be added with the format: <span class='highlight'>&amp;para_name</span> and multi values of a parameters are sepercated by commas <span class='highlight'>,</span> .");
	?>
	<br /><br />
	<?php 	
		echo JText::_("For example, both of the 2 following feeds return all Finance + Franchise jobs at any location published/posted on site in the last 30 days");
	?>
	<br /><br />
	
	<b>
	<?php 	
		echo JRoute::_(JURI::root()."index.php?option=com_jajobboard&view=jafeeds&cid[]=3&category=Finance,Franchise&effected_date=30");
	?>
	</b>
	<br /><br />
	<?php 	
		echo JText::_("This URL returns the list of open job from Financial + Design categories, in New York + Lodon & posted within the last 30 days,");
	?>
	<br /><br />
	<b>
	<?php 	
		echo JRoute::_(JURI::root()."index.php?option=com_jajobboard&view=jafeeds&cid[]=3&category=Financial, Design&location=New York");
	?>
	</b>
	<br /><br />
	<?php 	
		echo JText::_("And this example feed result for legal jobs in New York").'<br />';
	?>
    	<b>
	<?php 	
		echo JRoute::_(JURI::root()."index.php?option=com_jajobboard&view=jafeeds&cid[]=3&category=Legal&location=New York");
	?>
	</b>
	<br /><br />
	<?php 	
		echo JText::_("See the table below for the possible values for each of the parameters.");
	?>
	<br /><br />
	
</span>

<br /><br />
<table class="tablelist" width="100%">
	<tr>
		<td class="sectiontableheader" width="10%">
			<?php 
				echo JText::_("Parameter");
			?>
		</td>
		<td class="sectiontableheader" width="90%">
			<?php 
				echo JText::_("Description");
			?>
		</td>
	</tr>
	<tr class="first sectiontableentry1">	
		<td>
			<b>type</b>
		</td>
		<td>
			<?php 
				echo JText::_("We support follow type: RSS, RSS 0.91, RSS 1.0, RSS 2.0, MBOX, OPML, ATOM, ATOM 0.3, HTML, JS. Eg: type=RSS2.0 , the feed will output the feed in RSS2.0 format");
			?>
		</td>
	</tr>
	<tr class="sectiontableentry2">	
		<td>
			<b>name</b>
		</td>
		<td>
			<?php 
				echo JText::_("Name of the Feed");
			?>
		</td>
	</tr>
	<tr class="sectiontableentry1">	
		<td>
			<b>description</b>
		</td>
		<td>
			<?php 
				echo JText::_("Short description of the Feed");
			?>
		</td>
	</tr>
	<tr class="sectiontableentry2">	
		<td>
			<b>html</b>
		</td>
		<td>
			<?php 
				echo JText::_("yes or no");
			?>
		</td>
	</tr>
	<tr class="sectiontableentry1">	
		<td>
			<b>image</b>
		</td>
		<td>
			<?php 
				echo JText::_("yes or no");
			?>
		</td>
	</tr>
	<tr class="sectiontableentry2">	
		<td>
			<b>order_by</b>
		</td>
		<td>
			<?php 
				echo JText::_("value: desc, asc");
			?>
		</td>
	</tr>
	<tr class="sectiontableentry1">	
		<td>
			<b>category</b>
		</td>
		<td>
			<?php 
				echo JText::_("The categories of job, seperated by comma. Eg: category=financial,design");
			?>
		</td>
	</tr>
	<tr class="sectiontableentry2">	
		<td>
			<b>location</b>
		</td>
		<td>
			<?php 
				echo JText::_("The locations of job, seperated by comma Eg: location=New York,London will display jobs from New York + London only");
			?>
		</td>
	</tr>
	<tr class="sectiontableentry1">	
		<td>
			<b>effected_date</b>
		</td>
		<td>
			<?php 
				echo JText::_("The job in xx days. Eg: effected_date=30 will list all the jobs posted 30 days ago.");
			?>
		</td>
	</tr>
	<tr class="sectiontableentry2">	
		<td>
			<b>premium</b>
		</td>
		<td>
			<?php 
				echo JText::_("Value = 1 or 0. default=0 (meaning display both premium + standard jobs)");
			?>
		</td>
	</tr>
	
	<tr class="sectiontableentry1">	
		<td>
			<b>job_number</b>
		</td>
		<td>
			<?php 
				echo JText::_("The limit number of Jobs generated by RSS");
			?>
		</td>
	</tr>
	<tr class="sectiontableentry2">	
		<td>
			<b>exitems</b>
		</td>
		<td>
			<?php 
				echo JText::_("The excluded job ID which you do not want to display via RSS");
			?>
		</td>
	</tr>
	<tr class="sectiontableentry1">	
		<td>
			<b>inemployers</b>
		</td>
		<td>
			<?php 
				echo JText::_("The included Employers of which you want to get jobs from. Eg: inemployers=45 display open jobs from employer ID 45");
			?>
		</td>
	</tr>
	<tr class="sectiontableentry2">	
		<td>
			<b>exemployers</b>
		</td>
		<td>
			<?php 
				echo JText::_("The excluded Employers of which you want to get jobs from. Eg: exemployers=45, will display all jobs except jobs from employer ID 45");
			?>
		</td>
	</tr>
</table>
<a class="button" href="<?php echo JRoute::_("index.php?option=com_jajobboard&view=jafeeds&layout=form"); ?>" target="_blank"><?php echo JText::_("Create advance RSS"); ?></a>